webpackJsonp([49],{

/***/ "GQ3X":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/extends.js
var helpers_extends = __webpack_require__("4YfN");
var extends_default = /*#__PURE__*/__webpack_require__.n(helpers_extends);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/core-js/promise.js
var promise = __webpack_require__("rVsN");
var promise_default = /*#__PURE__*/__webpack_require__.n(promise);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/regenerator/index.js
var regenerator = __webpack_require__("lC5x");
var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__("J0Oq");
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);

// EXTERNAL MODULE: ./src/common/api/commonApi.js
var commonApi = __webpack_require__("+/+p");

// EXTERNAL MODULE: ./src/common/utils/index.js
var utils = __webpack_require__("dh3M");

// EXTERNAL MODULE: ./src/common/plugin/index.js + 207 modules
var common_plugin = __webpack_require__("Tvds");

// CONCATENATED MODULE: ./node_modules/_babel-loader@7.1.5@babel-loader/lib!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=script&index=0!./src/common/anjian/law/rectify.vue




//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//





/* harmony default export */ var rectify = ({
  data: function data() {
    return {
      form: {
        check_date: ''
      },
      selectList: [],
      userList: [],
      records: []
    };
  },
  activated: function activated() {
    var _this = this;

    return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee() {
      return regenerator_default.a.wrap(function _callee$(_context) {
        while (1) {
          switch (_context.prev = _context.next) {
            case 0:
              if (!_this.$router.$isBack) {
                _this.init();
                _this.fetchData();
                _this.fetchRecord();
              }

            case 1:
            case 'end':
              return _context.stop();
          }
        }
      }, _callee, _this);
    }))();
  },

  methods: {
    onPreview: function onPreview(loaded) {
      var _this2 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee2() {
        var word, _ref, url;

        return regenerator_default.a.wrap(function _callee2$(_context2) {
          while (1) {
            switch (_context2.prev = _context2.next) {
              case 0:
                _context2.prev = 0;
                _context2.next = 3;
                return commonApi["a" /* commonApi */].runCloud('officeCopy', {
                  code: 'D0003',
                  data: _this2.$route.query.id
                });

              case 3:
                word = _context2.sent;
                _context2.next = 6;
                return commonApi["a" /* commonApi */].runCloud('WordToPdf', { word: word });

              case 6:
                _ref = _context2.sent;
                url = _ref.url;

                if (url) {
                  _context2.next = 12;
                  break;
                }

                _this2.$Toast('文件转换失败，请尝试重新预览！', 'error');
                loaded();
                return _context2.abrupt('return');

              case 12:
                common_plugin["b" /* bridge */].PreviewPdf({ title: '文件标题', url: url });
                _context2.next = 17;
                break;

              case 15:
                _context2.prev = 15;
                _context2.t0 = _context2['catch'](0);

              case 17:
                loaded();

              case 18:
              case 'end':
                return _context2.stop();
            }
          }
        }, _callee2, _this2, [[0, 15]]);
      }))();
    },
    onSubmit: function onSubmit(loaded) {
      var _this3 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee3() {
        var form, objects, p;
        return regenerator_default.a.wrap(function _callee3$(_context3) {
          while (1) {
            switch (_context3.prev = _context3.next) {
              case 0:
                _context3.prev = 0;
                form = Object(utils["a" /* BuildPointer */])(_this3.form, {
                  check_person: 'aj_organization_personnel'
                });

                if (!(form.state !== 1)) {
                  _context3.next = 6;
                  break;
                }

                form.state = 1;
                _context3.next = 6;
                return commonApi["a" /* commonApi */].save('law_plan', {
                  id: _this3.$route.query.id,
                  state: 3
                });

              case 6:
                objects = _this3.selectList.map(function (item) {
                  return commonApi["a" /* commonApi */].createInstance('law_record_danger', {
                    id: item.id,
                    state: 1
                  });
                });
                p = [commonApi["a" /* commonApi */].save('law_rectify', form), commonApi["a" /* commonApi */].saveAll(objects)];
                _context3.next = 10;
                return promise_default.a.all(p);

              case 10:
                _this3.$router.$back();
                _this3.$Toast('保存成功!', 'success');
                _context3.next = 17;
                break;

              case 14:
                _context3.prev = 14;
                _context3.t0 = _context3['catch'](0);

                _this3.$Toast('保存失败!', 'error');

              case 17:
                loaded();

              case 18:
              case 'end':
                return _context3.stop();
            }
          }
        }, _callee3, _this3, [[0, 14]]);
      }))();
    },
    init: function init() {
      var _this4 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee4() {
        var form, _ref2, D0003;

        return regenerator_default.a.wrap(function _callee4$(_context4) {
          while (1) {
            switch (_context4.prev = _context4.next) {
              case 0:
                _this4.rectify = _this4.$route.query.rectify;
                _context4.next = 3;
                return commonApi["a" /* commonApi */].searchById('law_rectify', _this4.rectify);

              case 3:
                form = _context4.sent;

                _this4.form = Object(utils["c" /* PointerToString */])(form, ['check_person']);

                if (!_this4.form.document_num) {
                  _context4.next = 7;
                  break;
                }

                return _context4.abrupt('return');

              case 7:
                _context4.next = 9;
                return commonApi["a" /* commonApi */].runCloud('lawGetDocumentNum', {
                  year: new Date().getFullYear()
                });

              case 9:
                _ref2 = _context4.sent;
                D0003 = _ref2.D0003;

                _this4.form = extends_default()({}, _this4.form, { document_num: D0003 });

              case 12:
              case 'end':
                return _context4.stop();
            }
          }
        }, _callee4, _this4);
      }))();
    },
    fetchData: function fetchData() {
      var _this5 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee5() {
        return regenerator_default.a.wrap(function _callee5$(_context5) {
          while (1) {
            switch (_context5.prev = _context5.next) {
              case 0:
                _context5.next = 2;
                return commonApi["a" /* commonApi */].search('aj_organization_personnel', {
                  include: ['OrganizationIds'],
                  matchesQuery: {
                    OrganizationIds: commonApi["a" /* commonApi */].createQueryIncludeOptions('sys_organizations', {
                      equalTo: {
                        Name: '安监局执法'
                      }
                    })
                  }
                });

              case 2:
                _this5.userList = _context5.sent;

              case 3:
              case 'end':
                return _context5.stop();
            }
          }
        }, _callee5, _this5);
      }))();
    },
    fetchRecord: function fetchRecord() {
      var _this6 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee6() {
        var record;
        return regenerator_default.a.wrap(function _callee6$(_context6) {
          while (1) {
            switch (_context6.prev = _context6.next) {
              case 0:
                record = _this6.$route.query.record;
                _context6.next = 3;
                return commonApi["a" /* commonApi */].search('law_record_danger', {
                  equalTo: { record_id: record },
                  include: ['score']
                });

              case 3:
                _this6.records = _context6.sent;

                _this6.selectList = _this6.records.filter(function (v) {
                  return v.state;
                });

              case 5:
              case 'end':
                return _context6.stop();
            }
          }
        }, _callee6, _this6);
      }))();
    }
  }
});
// CONCATENATED MODULE: ./node_modules/_vue-loader@13.7.3@vue-loader/lib/template-compiler?{"id":"data-v-437e6394","hasScoped":true,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=template&index=0!./src/common/anjian/law/rectify.vue
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('yt-page',{attrs:{"title":"责令限期整改"}},[_c('yt-form',[_c('yt-cell',{attrs:{"label":"文书编号"}},[_c('yt-input',{attrs:{"clearable":false},model:{value:(_vm.form.document_num),callback:function ($$v) {_vm.$set(_vm.form, "document_num", $$v)},expression:"form.document_num"}})],1),_vm._v(" "),_c('yt-cell',{attrs:{"label":"整改期限"}},[_c('yt-cell-time',{model:{value:(_vm.form.check_date),callback:function ($$v) {_vm.$set(_vm.form, "check_date", $$v)},expression:"form.check_date"}})],1),_vm._v(" "),_c('yt-cell',{attrs:{"label":"审批人"}},[_c('yt-cell-select',{attrs:{"max":1,"list":_vm.userList,"label":"DisplayName","val":"id"},model:{value:(_vm.form.check_person),callback:function ($$v) {_vm.$set(_vm.form, "check_person", $$v)},expression:"form.check_person"}})],1),_vm._v(" "),_c('yt-textarea',{staticClass:"input",attrs:{"border":"none","title":"补充说明","placeholder":"请简单描述一下...","type":"row"},model:{value:(_vm.form.check_remarks),callback:function ($$v) {_vm.$set(_vm.form, "check_remarks", $$v)},expression:"form.check_remarks"}}),_vm._v(" "),_c('yt-split'),_vm._v(" "),_c('yt-cell',{attrs:{"label":"整改清单"}},[_c('yt-cell-select',{attrs:{"list":_vm.records,"text":"添加","max":999,"label":"danger_desc"},model:{value:(_vm.selectList),callback:function ($$v) {_vm.selectList=$$v},expression:"selectList"}})],1),_vm._v(" "),_vm._l((_vm.selectList),function(item,index){return _c('p',{key:index,staticClass:"row"},[_vm._v(_vm._s(index + 1)+": "+_vm._s(item.danger_desc))])}),_vm._v(" "),(_vm.form.state === 0)?_c('yt-btn',{attrs:{"slot":"btn","loading":_vm.onSubmit,"theme":"blue","edge":""},slot:"btn"},[_vm._v("保存")]):_c('yt-btn-group',{attrs:{"slot":"btn","shadow":false,"edge":""},slot:"btn"},[_c('yt-btn',{attrs:{"theme":"white","loading":_vm.onSubmit,"loadingOption":{color: '#46baff'}}},[_vm._v("保存")]),_vm._v(" "),_c('yt-btn',{attrs:{"theme":"white","loading":_vm.onPreview,"loadingOption":{color: '#46baff'}}},[_vm._v("预览文书")])],1)],2)],1)}
var staticRenderFns = []
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ var law_rectify = (esExports);
// CONCATENATED MODULE: ./src/common/anjian/law/rectify.vue
function injectStyle (ssrContext) {
  __webpack_require__("oMCn")
}
var normalizeComponent = __webpack_require__("C7Lr")
/* script */


/* template */

/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = "data-v-437e6394"
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
  rectify,
  law_rectify,
  __vue_template_functional__,
  __vue_styles__,
  __vue_scopeId__,
  __vue_module_identifier__
)

/* harmony default export */ var anjian_law_rectify = __webpack_exports__["default"] = (Component.exports);


/***/ }),

/***/ "oMCn":
/***/ (function(module, exports) {

// removed by extract-text-webpack-plugin

/***/ })

});